

function savedex(dexbytes,dexpath) {
Java.perform(function () {

    var FileOutputStream = Java.use("java.io.FileOutputStream");
    var File = Java.use("java.io.File");
    var fileobj = File.$new(dexpath);
    var fileoutputobj = FileOutputStream.$new(fileobj);
    fileoutputobj.write(dexbytes);
    fileoutputobj.close();



})
}


function fdex2(className) {

    Java.perform(function () {

        Java.enumerateClassLoadersSync().forEach(function (loader) {

            try {

                // var className="com.android.dex.Dex"; // getBytes getDex


                var Dex = loader.loadClass("com.android.dex.Dex");
                var methods = Dex.getDeclaredMethods();
                methods.forEach(function (method) {
                    var methodname = method.getName();
                    if(methodname == "getBytes"){
                        console.log("find getBytes-->"+method);
                    }
                })
            }catch (e) {

            };
            try {

                var class1 = loader.loadClass("java.lang.Class");
                var methods = class1.getDeclaredMethods();
                methods.forEach(function (method) {
                    var methodname = method.getName();
                    if(methodname == "getDex"){
                        console.log("find getDex-->"+method);
                    }
                })
            }catch (e) {

            };



        })
    })
}


// setTimeout(fdex2)
// 通过已知的类脱壳
// fs1\fdex2.js
// frida -H 127.0.0.1:8888 -f com.google.android.apps.maps  -l fdex2.js --no-pause


// fdex2("com.google.android.maps.MapsActivity")